NULL);
}
-/**
- * gdk_cursor_new_from_pixbuf:
- * @pixbuf: the #GdkPixbuf containing the cursor image
- * @x: the horizontal offset of the “hotspot” of the cursor.
- * @y: the vertical offset of the “hotspot” of the cursor.
- * @fallback: (allow-none): %NULL or the #GdkCursor to fall back to when
- * this one cannot be supported
- *
- * Creates a new cursor from a pixbuf.
- *
- * Not all GDK backends support RGBA cursors. If they are not
- * supported, a monochrome approximation will be displayed.
- * The functions gdk_display_supports_cursor_alpha() and
- * gdk_display_supports_cursor_color() can be used to determine
- * whether RGBA cursors are supported;
- * gdk_display_get_default_cursor_size() and
- * gdk_display_get_maximal_cursor_size() give information about
- * cursor sizes.
- *
- * If @x or @y are `-1`, the pixbuf must have
- * options named “x_hot” and “y_hot”, resp., containing
- * integer values between `0` and the width resp. height of
- * the pixbuf. (Since: 3.0)
- *
- * On the X backend, support for RGBA cursors requires a
- * sufficently new version of the X Render extension.
- *
- * Returns: a new #GdkCursor.
- *
- * Since: 2.4
- */
-GdkCursor *
-gdk_cursor_new_from_pixbuf (GdkPixbuf *pixbuf,
- gint x,
- gint y,
- GdkCursor *fallback)
-{
- GdkTexture *texture;
- const char *option;
- char *end;
- gint64 value;
- GdkCursor *cursor;
-
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
- g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
-
- if (x == -1 && (option = gdk_pixbuf_get_option (pixbuf, "x_hot")))
- {
- errno = 0;
- end = NULL;
- value = g_ascii_strtoll (option, &end, 10);
- if (errno == 0 &&
- end != option &&
- value >= 0 && value < G_MAXINT)
- x = (gint) value;
- }
-
- if (y == -1 && (option = gdk_pixbuf_get_option (pixbuf, "y_hot")))
- {
- errno = 0;
- end = NULL;
- value = g_ascii_strtoll (option, &end, 10);
- if (errno == 0 &&
- end != option &&
- value >= 0 && value < G_MAXINT)
- y = (gint) value;
- }
-
- texture = gdk_texture_new_for_pixbuf (pixbuf);
-
- cursor = gdk_cursor_new_from_texture (texture, x, y, fallback);
-
- g_object_unref (texture);
-
- return cursor;
-}
-
/**
* gdk_cursor_new_from_texture:
* @texture: the texture providing the pixel data
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
GDK_AVAILABLE_IN_ALL
GType gdk_cursor_get_type (void) G_GNUC_CONST;
-GDK_AVAILABLE_IN_ALL
-GdkCursor* gdk_cursor_new_from_pixbuf (GdkPixbuf *pixbuf,
- gint x,
- gint y,
- GdkCursor *fallback);
GDK_AVAILABLE_IN_3_94
GdkCursor* gdk_cursor_new_from_texture (GdkTexture *texture,
int hotspot_x,
GDK_AVAILABLE_IN_ALL
GdkCursor* gdk_cursor_new_from_name (const gchar *name,
GdkCursor *fallback);
-
+
GDK_AVAILABLE_IN_3_94
GdkCursor * gdk_cursor_get_fallback (GdkCursor *cursor);
GDK_AVAILABLE_IN_3_94